/**
 * @param {number[]} nums
 * @param {number} k
 * @return {number}
 */
 var coutPairs = function(nums, k) {
  const n = nums.length
  let arr = []
  const mp = new Map()
  for(let x of nums) {
    if(gcd(x, k) !== 1) {
      arr.push(x)
    }
    mp.set(x,(mp.get(x) ?? 0) + 1)
  }
  let ans = 0
  for(let x of arr) {
    ans += calc(x)
  }
  return ans
  function gcd(x, y) {
    if(y === 0) return x
    return gcd(y, x%y)
  }
  function scm(x, y) {
    return (x * y)/gcd(x,y)
  }
};

// [8,10,2,5,9,6,3,8,2]
// 6
// 18